package com.xls.rong;

import android.app.ActivityManager;
import android.app.Application;
import android.content.Context;
import android.os.Environment;
import android.os.Process;
import android.util.Log;

import com.xls.rong.entity.BaseEntity;
import com.xls.rong.http.RetrofitHttp;

import java.io.File;
import java.util.List;

import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;
import io.rong.imkit.RongIM;
import io.rong.imlib.RongIMClient;

/**
 * Created by Administrator on 2017/7/14.
 */

public class XlsApplication extends Application {

    private static final String TAG = "XlsApplication";
    public static final String BASE_DIR = Environment.getExternalStorageDirectory() + File.separator+"coffeeshop"+File.separator;
    public static final String CACHE_DIR = BASE_DIR+"cache";
    @Override
    public void onCreate() {
        super.onCreate();
        RongIM.init(this);
        /**
         * userId : 18217131583
         * userName: 神秘使者
         * token: KeeiHypGIjf7mCWbQhvHXeug8AmeJiqv+EAo9xlq+5b4pQMar6QRMV+NSYHkvLK4pY6qSMeiAUz+553z/UnzsCOMUCfTEvHi
         */
        /**
         * userId : 18721723436
         * userName : 夏冰
         * token : qGQ6soWsAdVDwJufKNuMRzOH87e+Bm23OHIKOEVnBr1W7G7FWRZspnsSiKSB+5sZe+FRtZisvSJ8jiXZgkzAwjxyj4fnslwv
         */
    }


    /**
     * 获取当前进程名
     * @param cxt
     * @param pid
     * @return
     */
    public static String getProcessName(Context cxt, int pid) {
        ActivityManager am = (ActivityManager) cxt.getSystemService(Context.ACTIVITY_SERVICE);
        List<ActivityManager.RunningAppProcessInfo> runningApps = am.getRunningAppProcesses();
        if (runningApps == null) {
            return null;
        }
        for (ActivityManager.RunningAppProcessInfo procInfo : runningApps) {
            if (procInfo.pid == pid) {
                return procInfo.processName;
            }
        }
        return null;
    }


}
